import '@js/init.js'
import{addData,subjectData} from '../utils/getData'
//渲染动态框
objectlistRender() 
async function  objectlistRender() {
    const data = await subjectData();
    console.log(data);
    const texthtml = data.map(item => {
        return ` <option value="${item._id}">${item.name}</option>`
    });
    $('#subjectsId').html(texthtml);
}


//点击添加
$('#addClassesBtn').click(function () {

    //   console.log($('#selectHeadTeacher').val(),$('#addClassesName').val());
    let id = $('#subjectsId').val();
  
    let name = $('#classesName').val();
    const rem= addData('/class/creatclass','post',{ name: name,
        objectId: id});
        if(rem){
            alert('添加成功')
        }
  });
